/* jshint esversion: 6 */
import Vue from "vue";
import VueRouter from "vue-router";
// import Home from '../views/Home.vue'

Vue.use(VueRouter);

// 注册页
// 路由也是正常的写法  这种是官方推荐的写法 按模块划分懒加载
const Register = (r) =>
    require.ensure([], () => r(require("../views/Register")), "Register2");

// 注册确认页
const registered = (resolve) => require(["../views/Registered"], resolve);

// 登录页
const login = (resolve) => require(["../views/Login"], resolve);

// 后台页
const index = (resolve) => require(["../views/index"], resolve);

// 是否显示路由控制
const meta = {
    // index: 0,
    showFooter: false,
};

const routes = [{
        path: "/",
        name: "Register",
        component: Register,
        meta,
    },
    {
        path: "/Registered",
        name: "Registered",
        // 路由懒加载方式2，不会提示警告
        component: registered,
        meta,
    },
    {
        path: "/login",
        name: "Login",
        component: login,
        meta,
    },
    {
        path: "/index",
        name: "Index",
        component: index,
        meta: {
            index: 0,
            showFooter: true,
        },
    },
];

const router = new VueRouter({
    mode: "hash",
    base: process.env.BASE_URL,
    routes,
});

export default router;